1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4 using
UnityEngine.UI;
5
6 public
class SliderValueTimer : MonoBehaviour {
7
8     
public Text sliderText;
9     
public Slider slider;
10
11     
private bool init = false;
12
13     
void Awake() {
14         
int oldTimer = PlayerPrefs.GetInt(GameManager.PLAYER_TIMER,GameManager.DEFAULT_PLAYER_TIMER_MIN);
15         sliderText.text = oldTimer.ToString();
16         slider.
value = oldTimer;
17         init =
true;
18     }
19
20     
public void OnValueChanged() {
21         
int value = ((int)slider.value);
22         sliderText.text =
value.ToString();
23
24         PlayerPrefs.SetInt(GameManager.PLAYER_TIMER,
value);
25     }
26 }


Gõ tìm kiếm nhanh...